import request from '@/utils/request'

// 定义公共的api 
const BASE_URL = '/system/user';

export default {
    // 查询用户和分页
    getUserPageInfo(page, limit, searchObj) {
        return request({
            url: `${BASE_URL}/${page}/${limit}`,
            method: 'get',
            params: searchObj
        })
    },
    // 添加或者修改
    saveOrUpdate(user) {
        return request({
            url: `${BASE_URL}/saveOrUpdate`,
            method: 'post',
            data: user
        })
    },
    // 查询所有宿管
    findAllManager(roleId) {
        return request({
            url: `${BASE_URL}//findAllManager`,
            method: 'get',
        })
    },
    // 查询所有
    findAll() {
        return request({
            url: `${BASE_URL}//findAll`,
            method: 'get',
        })
    },


    // 用户名唯一性判断
    selectByName(name) {
        return request({
            url: `${BASE_URL}/selectByName/${name}`,
            method: 'get'
        })
    },



    // 根据id去得到一个用户 
    getUserById(id) {
        return request({
            url: `${BASE_URL}/findUserById/${id}`,
            method: 'get'
        })
    },

    // 根据id去删除一个用户
    removeUserById(id) {
        return request({
            url: `${BASE_URL}/remove/${id}`,
            method: 'delete'
        })
    },
    updateStatus(id, activated) {
        return request({
            url: `${BASE_URL}/updateActivated/${id}/${activated}`,
            method: 'get'
        })
    },
}